//FUNÇÃO PARA COPIAR DIRETÓRIO

 

int __fastcall CopyDir( AnsiString SourceDir, AnsiString DestDir )

{

   char cSDir[MAX_PATH], cDDir[MAX_PATH];

   memset(cSDir, 0, MAX_PATH);

   memset(cDDir, 0, MAX_PATH);

   strcpy(cSDir, SourceDir.c_str());

   strcpy(cDDir, DestDir.c_str());

 

   SHFILEOPSTRUCT dfstruct;

   ZeroMemory(&dfstruct, sizeof(dfstruct));

   dfstruct.hwnd = Application->Handle;

   dfstruct.wFunc = FO_COPY;

   dfstruct.pFrom = cSDir;

   dfstruct.pTo = cDDir;

   dfstruct.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR;

   return SHFileOperation(&dfstruct);

 

}